<script type="text/javascript">
$(function () {
	var url = '${contextPath}script/inv/invReturnSales.js';
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
		}
	});
	$('.add-tag-input').keydown(function(e){
		  if (e.keyCode==13){
		 	 addTag_invReturnSales($(this));
		  }
		});
});
</script>

<style>
.my-filter-table {
	background: linear-gradient(to bottom, #F1FAFE 0%, #D9EDF7 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);
	border: 1px solid #9BE2F0;
	display: inline-block;
	margin-bottom: 5px;
	margin-left: 5px;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.my-filter-table a {
	color: #3A87AD;
    display: inline-block;
    margin: 0 4px;
}

.my-filter-table button {
	background: none repeat scroll 0 0 rgba(0, 0, 0, 0);
    border: 0 none;
    cursor: pointer;
    padding: 0;
    color: #000000;
    float: right;
    font-size: 20px;
    font-weight: bold;
    line-height: 20px;
    opacity: 0.4;
    text-shadow: 0 1px 0 #FFFFFF;
}

.add-tag-input {
	width:80px;
}
</style>

<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<div>
	<h3 class="title"><i class="fontello-icon-th-list-1"></i> 编辑退货信息</h3>
</div>
<h4>&nbsp;&nbsp;</h4>
<div class="widget" >
	<div class="widget-content">
		<form id="editForm">
		<input  id="type" name="type" value="1" type="hidden"/>
			<table style="width: 80%" class="table table-bordered animate2 fadeInUp">
				<tr>
					<td>来往单位:&nbsp;&nbsp;
						<div class="input-append">
							<input class="bn not-null" id="bname" name="bname" value="${(sales.bname)!''}" type="text" style="width:160px;" readonly />
							<input id="bc" name="bc" value="${(sales.bc)!''}" type="hidden" />
							<button class="btn btn-xs btn-primary" type="button" onclick="javascript:selectBn_invReturnSales($(this));return false;"><i class="icon-search"></i></button>
						</div>
					</td>
					<td rowspan="3">退货原因:&nbsp;&nbsp;<textarea id="remark" name="remark" value="${(sales.remark)!''}" rows="4" cols="50"/></td>
				</tr>
				<tr>
					<td>应退金额:&nbsp;&nbsp;<input id="total1" type="text"/></td>
				</tr>
				<tr><td>实退金额:&nbsp;&nbsp;<input id="total" name="total" value="0" type="text"/></td></tr>
			</table>
			<table style="width: 80%" class="table table-bordered animate2 fadeInUp">
				<thead>
					<tr height="40">
						<th>商品名称<a href="javascript:;" onclick="javascript:add_invReturnSales();return false;" style="margin-left: 10px">[添加空白行]</a></th>
						<th>序列号状态</th>
						<th style="width:40px;">数量</th>
						<th style="width: 60px">单价（元）</th>
						<th>入库仓库</th>
						<th style="width:30px;">操作</th>
					</tr>
				</thead>
				<tbody id="ListBody">
				<#assign i = 0 />
					<tr class="rep">
						<td>
							<div class="input-append">
								<input class="cname not-null" id="cname_${i}" name="itemList[${i}].cname" value="${(sales.cname)!''}" type="text" style="width:120px;" readonly />
								<input id="cc_${i}" name="itemList[${i}].cc" value="${(sales.cc)!''}" type="hidden" />
								<input type="hidden" name="itemList[${i}].code" value="${(sales.code)!''}"/>
								<button class="btn btn-xs btn-primary" pib="${i}" type="button" onclick="javascript:selectCn_invReturnSales($(this));return false;"><i class="icon-search"></i></button>
							</div>
						</td>
						 <td><input id="snc_${i}" class="snc" name="itemList[${i}].snc" type="hidden" value="${(sales.snc)!''}" readonly/><span id="s_${i}" class="s"><#if invReturnSales?? && invReturnSales.snc == 1>无需序列号<#elseif invReturnSales?? && invReturnSales.snc == 2>同类序列号<#elseif invReturnSales?? && invReturnSales.snc == 3>唯一序列号</#if></span></td>
						<td><input class="count not-null" id="count_${i}" type="text" name="itemList[${i}].count" value="${(sales.count)!''}" style="width:60px;" <#if invReturnSales?? && invReturnSales.snc == 3>onMouseUp ="show_invReturnSales(${i});" readonly="readonly"<#else></#if> onkeyup="javascript:checkNum_invReturnSales($(this));return false;"/></td>
						<td><input class="price not-null" type="text" name="itemList[${i}].price" value="0" onchange="price_invReturnSales();return false;" style="width:80px;"/></td>
						<td>
							<div class="input-append">
								<input class="dn not-null" id="dname_${i}" name="itemList[${i}].dname" value="${(sales.dname)!''}" type="text" style="width:100px;" readonly />
								<input id="dc_${i}" name="itemList[${i}].dc" value="${(sales.dc)!''}" type="hidden" />
								<button class="btn btn-xs btn-primary" pib="${i}" type="button" onclick="javascript:selectDn_invReturnSales($(this));return false;"><i class="icon-search"></i></button>
							</div>
						</td>
						<td style="text-align:center;"><a class="btn btn-danger" href="javascript:;" onclick="javascript:delete_invReturnSales($(this));return false;"><i class="icon-remove"></i></a></td>
					</tr>
					<tr>
						<td id="biao_${i}" colspan="7" style="display:none;" j="0">
							<div>
								<font>请输入序列号:</font><input i="${i}" type="text" class="add-tag-input" /><a href="javascript:;" class="btn btn-info" onclick="javascript: addTag_invReturnSales($(this).prev()); return false;" >确认</a>
							</div>
							<div id="div_biao_${i}" class="div">
							
							</div>
						</td>
					</tr>
				<#assign i = i + 1/>
				</tbody>
				<tr>
					<td colspan="7" style="color: red;">
						无需序列号的请直接输入入库数量，同类序列号的如果已有序列号入库的无需再输入序列号  可直接输入入库数量，唯一序列号需依次输入序列号。
					</td>
				</tr>
				<tr height="40">
					<td colspan="7" style="text-align: center;">
						<a href="javascript:;" class="btn btn-info" onclick="javascript: save_invReturnSales(); return false;"><i class="icon-save"></i>&nbsp;保&nbsp;&nbsp;存</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="javascript:;" class="btn btn-primary" onclick="javascript: sys_load_handle('invReturnSales');return false;"><i class="fontello-icon-block"></i>&nbsp;取&nbsp;&nbsp;消</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>

<input type="hidden" id="index" value="${i}" />
<table id="tempTable" style="display:none;">
	<tr class="rep">
		<td>
			<div class="input-append">
				<input class="cname not-null" type="text" style="width:120px;" readonly />
				<input class="cc" type="hidden" />
				<button class="btn btn-xs btn-primary" type="button" onclick="javascript:selectCn_invReturnSales($(this));return false;"><i class="icon-search"></i></button>
			</div>
		</td>
		 <td><input class="snc" type="hidden" readonly/><span class="s"></span></td>
		<td><input class="count not-null" type="text" style="width:60px;" onkeyup="javascript:checkNum_invReturnSales($(this));return false;"/></td>
		<td><input class="price not-null" type="text" style="width:80px;" onchange="price_invReturnSales();return false;"/></td>
		<td>
			<div class="input-append">
				<input class="dname not-null" type="text" style="width:100px;" readonly />
				<input class="dc" type="hidden" />
				<button class="btn btn-xs btn-primary" type="button" onclick="javascript:selectDn_invReturnSales($(this));return false;"><i class="icon-search"></i></button>
			</div>
		</td>
		<td style="text-align:center;"><a class="btn btn-danger" href="javascript:;" onclick="javascript:delete_invReturnSales($(this));return false;"><i class="icon-remove"></i></a></td>
	</tr>
	<tr><td colspan="7" style="display:none;" j="0">
		<div>
			<font>请输入序列号:</font>
			<input i="${i}" type="text" class="add-tag-input"/><a href="javascript:;" class="btn btn-info" onclick="javascript: addTag_invReturnSales($(this).prev()); return false;" >确认</a>
		</div>
		<div id="div_biao_${i}" class="div">
						
		</div>
		</td></tr>
</table>
<div id="temp" style="display:none;">
	<div class="my-filter-table rep">
		<input class="t form-control" type="hidden" style="width:60px;"/>
		<a href="javascript:;"></a>&nbsp;&nbsp;&nbsp;&nbsp;
		<button type="button" class="del-tag" data-dismiss="alert">&times;</button>
	</div>
</div>